import { request } from "@yaf/request";
import { toApi } from "@/service/proxyApi";
import { RespDataType } from "./apiType";
export * from "./apiType";

const { get, del } = request;

/**
 * 获取操作日志分页列表
 */
export const getOperLogPageList = (params: {
  page: number,
  pageSize: number,
  requestMethod?: string;
  operName?: string;
  dateRange?: string[];   // YYYY-MM-DD
}) => {
  return get<RespDataType.OperLogPageList>(toApi("api/v1/system/operLog/list"), params);
}

/**
 * 删除操作日志
 */
export const deleteOperLog = (operIdList: number[]) => {
  return del(toApi("api/v1/system/operLog/delete?operIds=" + JSON.stringify(operIdList)));
}

/**
 * 清除所有操作日志
 */
export const clearOperLog = () => {
  return del(toApi("api/v1/system/operLog/clear"));
}
